package com.sample;

import java.util.Arrays;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

import com.swak.boot.Application;
import com.swak.utils.Fmt;

/**
 * 测试启动
 * 
 * @author 618lf
 */
@SpringBootApplication
public class UserApp implements CommandLineRunner {

	@Autowired
	private ApplicationContext appContext;

	@Override
	public void run(String... args) throws Exception {
		String[] beans = appContext.getBeanDefinitionNames();
		Arrays.sort(beans);
		for (String beanName : beans) {
			Object bean = appContext.getBean(beanName);
			Fmt.out.println(beanName + " ## " + bean);
		}
	}

	public static void main(String[] args) {
		Application.run(UserApp.class, args);
	}
}